Developer Documentation
PATH  Mac OS X Documentation > Cocoa > Application Design for Scripting, Documents, and Undo


Previous | Chapter contents | Next | Book PDF

View Objects Present Information to the User

A view object knows how to display and possibly edit data from the application's model. Ideally, the view should not store the data it is displaying. (This is intended semantically, of course. A view can cache data or do similar tricks for performance reasons). A view object can be in charge of displaying just one part of a model object, or a whole model object, or even many different model objects. Views come in many different varieties.

A view should ensure it is displaying the model correctly. Consequently, it usually needs to know about changes to the model. Because model objects should not be tied directly to view objects, they need a generic way of indicating that they have changed. Toward this end, they can either post NSNotifications when they are altered or define another general way for passing change notifications to the views, usually through the controller layer.


Application Design for Scripting, Documents, and Undo

Previous | Chapter contents | Next | Book PDF